package AbstractTransactions

import "SPC/Model"

type ChangeAffiliationTransaction struct {
	ChangeEmployeeTransaction
	RecordMembership func(e Model.Employee)
	GetAffiliation   func() Model.Affiliation
}

func NewChangeAffiliationTransaction(empId int) *ChangeAffiliationTransaction {
	return &ChangeAffiliationTransaction{
		*NewChangeEmployeeTransaction(empId),
		nil,
		nil,
	}
}

func (c *ChangeAffiliationTransaction)Change(e Model.Employee){
	c.RecordMembership(e)
	af := c.GetAffiliation()
	e.SetAffiliation(af)
}